package com.hefei.mybatisplus.mp.controller;


import com.hefei.mybatisplus.mp.entity.User;
import com.hefei.mybatisplus.mp.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * mybatisplus-demo 前端控制器
 * </p>
 *
 * @author caizhengjun
 * @since 2020-10-09
 */
@RestController
@RequestMapping("/mp/user")
public class UserController {

    @Autowired
    private IUserService userService;

    @GetMapping("/{uid}")
    public User test(@PathVariable Long uid) {
        return this.userService.getById(uid);
    }

    @PostMapping
    public boolean update(@RequestBody User user) {
        return this.userService.updateById(user);
    }
}

